package com.lee.message.mapper;

import com.lee.common.model.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MessageMapper {
    int insert(Message row);

    int insertSelective(Message row);

    Message selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Message row);

    int updateByPrimaryKey(Message row);

    /**
     * 获取未读站内信数量
     * @param receiveUserId 接收者Id
     * @return
     */
    Integer selectUnReadCount(@Param("receiveUserId") Long receiveUserId);

    /**
     * 根据Id查询站内信列表
     * @param receiveUserId 接收者Id
     * @return
     */
    List<Message> selectByReceiveUserId(@Param("receiveUserId") Long receiveUserId);

    /**
     * 根据当前用户id查询发信人列表
     * @param receiveUserId 接收者Id
     */
    List<Message> selectPostUserByReceiveId(@Param("receiveUserId") Long receiveUserId);

    /**
     * 根据当前用户id和postUserId查询聊天记录
     * @param receiveUserId 接收者Id
     * @param postUserId 接收者Id
     */
     List<Message> selectChatHistoryById(@Param("receiveUserId") Long receiveUserId,@Param("postUserId") Long postUserId);

}